<template>
    <div>
        <div class="crumbs">
            <el-breadcrumb separator="/">
                <el-breadcrumb-item>
                    <i class="el-icon-lx-cascades"></i> 发票信息
                </el-breadcrumb-item>
            </el-breadcrumb>
        </div>
        <div class="container">
            <el-table
                :data="billsData"
                border
                class="table"
                ref="multipleTable"
                header-cell-class-name="table-header"

            >
                <el-table-column prop="Bill_id" label="发票编号" width="100" align="center"></el-table-column>
                <el-table-column prop="Order_id" label="订单编号" width="100" align="center"></el-table-column>
                <el-table-column prop="Consumer_name" label="顾客姓名" align="center"></el-table-column>
                <el-table-column prop="Goods_name" label="商品名称" align="center"></el-table-column>
                <el-table-column prop="Sum_money" label="总金额" align="center"></el-table-column>
				<el-table-column prop="Bill_class" label="发票类别" align="center"></el-table-column>
				<el-table-column prop="Bill_date" label="日期" align="center"></el-table-column>
				<el-table-column label="操作" width="180" align="center">
                    <template #default="scope">
                        <el-button
                            type="primary"
                            icon="el-icon-delete"
                            class="red"
                            @click="handleDelete(scope.row)"
                        >删除</el-button>
                    </template>
                </el-table-column>
            </el-table>
        </div>
    </div>
</template>

<script>
    import {billdelete, fetchbillData} from "../api";
export default {
    name: "billData",
    data() {
        return {
			billsData: [],
			
			billdeletedata :{},
            query: {
                address: "",
                name: "",
                pageIndex: 1,
                pageSize: 10
            },
            multipleSelection: [],
            delList: [],
            editVisible: false,
            pageTotal: 0,

            idx: -1,
            id: -1
        };
    },
    created() {
        this.getData();
    },
    methods: {
        getData(){
            fetchbillData().then(res =>{console.info(res)
                this.billsData=res.data.value
            })
        },
        // 触发搜索按钮
        handleSearch() {
            this.getData();
        },
        // 删除操作
        handleDelete(row) {
            this.billdeletedata = row
            billdelete(this.billdeletedata).then(res =>{console.info(res)
                console.log(this.billdeletedata)
                console.log(res)
            })
            window.location.reload()
        },
        // 编辑操作
        handleEdit(index, row) {
            this.idx = index;
            this.form = row;
            this.editVisible = true;
        },
        // 保存编辑
        saveEdit() {
            this.editVisible = false;
            this.$message.success(`修改第 ${this.idx + 1} 行成功`);
            this.$set(this.tableData, this.idx, this.form);
        },
        // handleDelete(index,row){
        //
        //
        // }
    }
};
</script>

<style scoped>
.handle-box {
    margin-bottom: 20px;
}

.handle-select {
    width: 120px;
}

.handle-input {
    width: 300px;
    display: inline-block;
}
.table {
    width: 100%;
    font-size: 14px;
}
.red {
    color: #ff0000;
}
.mr10 {
    margin-right: 10px;
}
.table-td-thumb {
    display: block;
    margin: auto;
    width: 40px;
    height: 40px;
}
</style>
